package com.ehome.android_build_plugin

import android.content.Context
import android.os.SystemProperties
import com.efs.sdk.base.EfsReporter
import com.efs.sdk.launch.LaunchManager
import com.ehome.mvvm.arms.base.BaseApplication
import com.umeng.analytics.MobclickAgent
import com.umeng.commonsdk.UMConfigure
import java.util.Locale

class App : BaseApplication() {
    override fun attachBaseContext(base: Context?) {
        LaunchManager.onTraceApp(this, LaunchManager.APP_ATTACH_BASE_CONTEXT, true)
        super.attachBaseContext(base)
        LaunchManager.onTraceApp(this, LaunchManager.APP_ATTACH_BASE_CONTEXT, false)
    }

    override fun onCreate() {
        super.onCreate()
//        val efsReporter = EfsReporter.Builder(this, "","")
//            .build()
//        LaunchManager.init(this, efsReporter)

        UMConfigure.setLogEnabled(true)
//        Bundle bundle = new Bundle();
//        bundle.putBoolean(UMCrash.KEY_ENABLE_CRASH_JAVA, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_CRASH_NATIVE, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_ANR, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_PA, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_LAUNCH, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_MEM, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_NET, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_PAGE, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_POWER, true);
//        bundle.putLong(UMCrash.KEY_PA_TIMEOUT_TIME, 2000L);
//        UMCrash.initConfig(bundle);
        //        Bundle bundle = new Bundle();
//        bundle.putBoolean(UMCrash.KEY_ENABLE_CRASH_JAVA, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_CRASH_NATIVE, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_ANR, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_PA, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_LAUNCH, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_MEM, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_NET, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_PAGE, true);
//        bundle.putBoolean(UMCrash.KEY_ENABLE_POWER, true);
//        bundle.putLong(UMCrash.KEY_PA_TIMEOUT_TIME, 2000L);
//        UMCrash.initConfig(bundle);
        UMConfigure.init(this, null, SystemProperties.get("ro.vendor.ehome.project"), UMConfigure.DEVICE_TYPE_BOX, "")
        MobclickAgent.onProfileSignIn(
            SystemProperties.get("persist.vendor.ehome.enviroment").uppercase(Locale.getDefault()),
            SystemProperties.get("ro.serialno")
        )

        LaunchManager.onTraceApp(this, LaunchManager.APP_ON_CREATE, false);
    }
}
